#include<stdio.h>
typedef struct{int numarator;
                int numitor;
               }Rational;

Rational suma(Rational f1,Rational f2);
Rational produs(Rational f1,Rational f2);
Rational diferenta(Rational f1,Rational f2);
Rational q(Rational f1,Rational f2);

Rational suma(Rational f1,Rational f2)
{Rational f3;
 f3.numarator=f1.numarator*f2.numitor+f1.numitor*f2.numarator;
 f3.numitor=f1.numitor*f2.numitor;
 return simplificare(f3);
}

Rational produs(Rational f1, Rational f2)
{Rational f3;
 f3.numarator=f1.numarator*f2.numarator;
 f3.numitor=f1.numitor*f2.numitor;
 return simplificare(f3);
}

Rational diferenta(Rational f1,Rational f2)
{f2.numarator=-f2.numarator;
 return suma(f1,f2);
}

Rational q(Rational f1,Rational f2)
{Rational t;
 t.numarator=f2.numitor;
 t.numitor=f2.numarator;
 return produs(f1,f2);
}

int main()
{Rational f1,f2,t,c;
 f1.numarator=1;
 f1.numitor=4;
 f2.numarator=1;
 f2.numitor=2;
 t=produs(f1,f2);
 printf("\n%d\n%d\n",t.numarator,t.numitor);
 c=q(f1,f2);
 printf("\n%d_|_%d\n",c.numarator,c.numitor);
 return 0;
}
